convert char** to cv::Mat
Hi to everyone! I am trying to convert raw image data from my IP camera to cv::Mat. But can't do it properly. My IP camera use it's own library to retrieve images. This function looks like
GetVideoData(hwnd, (char**)&Frame, &dataLen, videofmt,&mediaSpeed);
Frame has a data buffer of type char data[0] in it's struct; Can anybody help me to find out how to convert Frame->data to cv::Mat?
I tried to do it like:
cv::Mat cameraFrame = cv::Mat(h, w, CV_8UC1, Frame->data);
But when i am trying to show it with imshow("name",cameraFrame); it looks like gray and very pure image.. C:\fakepath\Screen.JPG
what is
Frame
, exactly ? please show us the declaration. same withGetVideoData()
Here is the declaration of GetVideoData function:
Here is struct of the Frame datatype:
I need only Frame->data. This is the data of the image from IP camera stream. Finally i need to convert it to cv::Mat, make facerecognition processing, and convert the image back to char* data, that i can draw it with IP camera function
Also i tried to use another way of convertion, and it behaves different. Here i convert the Frame->data to cv:Mat:
make some face recognition processing with cameraFrame and finally trying to draw the image this way:
And now i got the color image, but it seems like it mirrored or i dont know how to explaine. Here is a link i upload the screen shot.
</a">link text
If i use imshow() instead of DrawVideoIamge(). I've got the gray image like on the previos screen i posted.
try
cv::Mat cameraFrame = cv::Mat(h, w, CV_8UC3, Frame->data);
CV_8UC3 doesn't work for this code(throws c000005):
If use CV_8UC3 with this code:
Results the almost the same as for CV_8UC1. But now it lookes like triple image.
Here is CV_8UC3 with imshow():
Here is CV_8UC3 with DrawVideoIamge():
try
Just tried:
It throws an exception on the memcpy line of code: